package test.test_7_13;
/*
现在有T1、T2、T3三个线程，你怎样保证T2在T1执行完后执行，T3在T2执行完后执行？
利用线程控制API
 */
public class Demo02 {
    public static void main(String[] args) {
        Thread t1 = new Thread() {
            @Override
            public void run() {
                System.out.println("t1");
            }
        };

        Thread t2 = new Thread() {
            @Override
            public void run() {
                System.out.println("t2");
            }
        };

        Thread t3 = new Thread() {
            @Override
            public void run() {
                System.out.println("t3");
            }
        };

        //保证先执行t1 t2 t3
        try {
            t1.start();
            t1.join();
            t2.start();
            t2.join();
            t3.start();
            t3.join();
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
    }
}
